<?php
/**
 * User: b179a9
 * Date: 10/13/11
 * Time: 9:05 PM 
 */
 
class Lib_GeoCoords {

    public static function getCoords($query) {

        $key = Zend_Registry::get('config')->resources->frontController->mapApiKey;

        $client = new Zend_Http_Client('http://maps.googleapis.com/maps/geo');
        $client->setParameterGet('q', $query)
            ->setParameterGet('output', 'json')
            ->setParameterGet('sensor', 'false')
            ->setParameterGet('key', $key);

        $request = $client->request(Zend_Http_Client::GET);
        $body = $request->getBody();
        return json_decode($body, true);
    }

}
